<template>
  <div id="virtual-scroll-target" class="scroll" style="max-height: 230px">
    <div class="q-pa-md bg-purple text-white">
      Above the list - scrolls with the list
    </div>

    <t-virtual-scroll
      scroll-target="#virtual-scroll-target"
      :items="heavyList"
      separator
      v-slot="{ item, index }"
    >
      <t-item :key="index" dense>
        <t-item-section>
          <t-item-label> #{{ index }} - {{ item.label }} </t-item-label>
        </t-item-section>
      </t-item>
    </t-virtual-scroll>

    <div class="q-pa-md bg-purple text-white">
      Below the list - scrolls with the list
    </div>
  </div>
</template>

<script>
  const maxSize = 10000;
  const heavyList = [];

  for (let i = 0; i < maxSize; i++) {
    heavyList.push({
      label: 'Option ' + (i + 1),
    });
  }

  export default {
    setup() {
      return {
        heavyList,
      };
    },
  };
</script>
